<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/7/23 14:38
 * Modified Time: 2019/7/23 14:38
 * Version: 2.0
 */

namespace App\Lib\File;


use App\Models\Video;

class AliOssVideo
{
    /*
    * 上传视频
    */
    public function upload($tmp,$path,$sqlname="视频")
    {
        $ali_oss = new AliOSS();
        $oss = $ali_oss->upload($tmp,$path);

        //制作缩略图
        $img = $oss['ossName']."?x-oss-process=video/snapshot,t_1,f_jpg,m_fast";

        $new_video  = new Video();

        $new_video->name = $sqlname;
        $new_video->url = $oss['ossName'];
        $new_video->thumb = $img;
        $new_video->save();

        return $new_video;

    }

    public function delete()
    {
        // TODO: Implement delete() method.
    }

    public function getFileSize()
    {
        // TODO: Implement getFileSize() method.
    }

    public function getFileType()
    {
        // TODO: Implement getFileType() method.
    }
}